package com.hangzhou.xyj.net.request;

import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.hangzhou.xyj.net.request.base.BaseRequest;
import com.hangzhou.xyj.utils.StringUtil;
import com.hangzhou.xyj.utils.constants.API;

/**
 * Created by yaohuix on 2016/4/6  13:40
 * <p/>
 * 说明：获取token值
 */
public class GetTokenReq extends BaseRequest {

    public GetTokenReq(String deviceId, String userId) {
        JsonObject jsonObject = new JsonObject();
        if (StringUtil.isNotEmpty(userId)) {
            jsonObject.addProperty("userAccount", userId);
        }
        jsonObject.addProperty("appId", "xiyouji");
        jsonObject.addProperty("deviceId", deviceId);
        jsonObject.addProperty("type", "android");
        String jsonStr = new Gson().toJson(jsonObject);
        add("data", jsonStr);
    }

    @Override
    public String getUrl() {
        return API.GET_TOKEN;
    }

}
